package com.jinke.uang.adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.jinke.uang.R;
import com.jinke.uang.base.BaseRecyclerAdapter;
import com.jinke.uang.bean.HelpCenterData;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

public class HelpAdapter extends BaseRecyclerAdapter<HelpCenterData, HelpAdapter.HelpViewHolder> {

    public HelpAdapter(Context context) {
        super(context);
    }

    @NonNull
    @Override
    public HelpViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
        return new HelpViewHolder(inflater.inflate(R.layout.item_help_detail, viewGroup, false));
    }

    @SuppressLint("SetTextI18n")
    @Override
    public void onBindViewHolder(@NonNull HelpViewHolder holder, int position) {
        holder.tvQuestion.setText("Q    " + mDatas.get(position).getTitle());
        holder.tvAnswer.setText("A    " + mDatas.get(position).getMessage());
    }

    public static class HelpViewHolder extends RecyclerView.ViewHolder {

        TextView tvQuestion;
        TextView tvAnswer;

        public HelpViewHolder(View itemView) {
            super(itemView);
            tvQuestion = itemView.findViewById(R.id.tv_question);
            tvAnswer = itemView.findViewById(R.id.tv_answer);
        }
    }
}
